<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Market Entity Creation</title>
<script type="text/javascript" src="Javascript/Market.js"></script>
<LINK REL="stylesheet" HREF="CSS/Main.css" TYPE="text/css">
<LINK REL="stylesheet" HREF="CSS/Button.css" TYPE="text/css">
</head>
<body>

	<div id="top">
		<h1>Master Data Management</h1>
		<br>
		<a id="log" href="logout">Logout</a><br>
    		<%@ include file="redirection.jsp" %>
		<div id="menu">
	      <ul>
	        <li>
	        	<form action = "logout" method="post">
					<a><input type="submit" name="Logout" value="Logout"></a>
				</form>
			</li>
	      </ul>
	    </div>
	</div>

<h2>Market Creation</h2>
	<div id="left">
		<div class="box">
		<%String[] market = (String[]) request.getAttribute("market");
		String status = (String) request.getAttribute("status"); %>
		<%
					if (market == null && status == null) {
				%>

					<form name='header' action='MarketCreate' method="get">
                                 <script type="text/javascript">
                                        document.forms['header'].submit();
                                 </script>
                           </form>
         <%
               }
         %>
		<form action="MarketCreate" method="post" onsubmit="return vi()">         
			<table>
				<tr>
					<td>Market Name</td>
					<td>
						<input type="text" id="marketname" name="MarketName">
					</td>
				</tr>
				<tr>
					<td>Location</td>
					<td>
				        <select name="selected1">
							<%String[] loc = (String[]) request.getAttribute("Location");
							if(loc!=null){
								for(String s:loc){%>
										<option value="<%=s%>" ><%=s%></option>
									<%
							}}%>
						</select> 
					</td>
				</tr>
				<tr>
					<td>Community Type</td>
					<td>
						<select name="selected2">
								<%String[] com = (String[]) request.getAttribute("Commodity");
								if(com!=null){
									for(String s:com){%>
											<option value="<%=s%>" ><%=s%></option>
										<%
								}}%>
						</select>
					</td>
				</tr>
				<tr>
					<td>Currency</td>
					<td>
						<select name="selected3">
							<%String[] cur = (String[]) request.getAttribute("Currency");
							if(cur!=null){
								for(String s:cur){%>
										<option value="<%=s%>" ><%=s%></option>
									<%
							}}%>
						</select>
					</td>
				</tr>
				<tr>
					<td>Start Date:</td>
					<td><input type="date" id="startDate" name="startDate" id="startDate" ></td>
				</tr>
				<tr>
				<tr>
					<td>End Date:</td>
					<td><input type="date" id="endDate" name="endDate" id="endDate" ></td>
				</tr>
				<tr>
					<td>
					<input type="submit" class="button" name="submit" value="submit">
					</td>
					<%=(request.getAttribute("status")==null) ? "":request.getAttribute("status")%>
				</tr>
			</table>
			<br>
			<article id="warning"></article><br>
		</form>
		</div>



     <div class="visbox">
       <table>
              <tr>
       
                   			<%if(session.getAttribute("role").equals("admin")){%>
                   			<td><form action="ControlPanel.jsp">
				<input type="submit" class="button" name="Back" value="Back">
			</form></td>
				<td><form action="Home.jsp">
					<input type="submit" class="button"name="Home" value="Home">
				</form></td>		
			<%}else{%>
			<td><form action="ControlPanelUser.jsp">
				<input type="submit" class="button" name="Back" value="Back">
			</form></td>
			<td>	<form action="HomeUser.jsp">
					<input type="submit" class="button"name="Home" value="Home">
				</form></td>	
			<% }%>	
         
              </tr>
       </table>
     </div>
 </div>    

</body>
</html>